package com.heima.controller;


import com.heima.result.Result;
import com.heima.service.IDepartmentService;
import com.heima.vo.DepartmentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 科室 前端控制器
 * </p>
 *
 * @author 黑马程序员
 * @since 2023-01-29
 */
@RestController
@RequestMapping("/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService departmentService;

    @GetMapping("list")
    public Result list(@RequestParam(defaultValue = "1") Integer page
            , @RequestParam(defaultValue = "10") Integer pageSize) {
        List<DepartmentVo> all = departmentService.getAll(page, pageSize);
        return Result.success(all);
    }
}

